% Generate Table 4.
% Run Figure3.m before executing this file.

clear
clc

% Designate working directories
dir = '.../Replication package/';
cd(dir);
addpath(genpath(strcat(dir,"Code/src")))
addpath(genpath(strcat(dir,"Datasets")))

% Import the data for the selected lambda values generated in Figure 3.m.
opt_lambda = load("selected_lambdas.mat").rec_opt_lambda;

theta_grid = -0.6:0.2:0.6;

mean_lam = mean(opt_lambda(:,1:2:end), 1);
pos_prob = mean((opt_lambda(:,1:2:end) > 0), 1);

fprintf('    stats. \t %.1f\t%.1f\t%.1f\t%.1f\t%.1f\t%.1f\t%.1f \n', theta_grid);
fprintf('----------------------------------------------------------------------\n');
fprintf('mean lambda \t %.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f \n', mean_lam);
fprintf('pos. prob. \t %.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f \n', pos_prob);